import {createI18n} from 'vue-i18n'
import es_mx from './es_mx/index.js'
import zh_cn from './zh_cn/index.js'

let defaultLocale = localStorage.getItem('locale')
/**
 * localeValue 默认语言
 * zh_CN 中文
 * en_IN 英文
 */
let timer = null
const obj = es_mx
const i18n = createI18n({
    locale: localStorage.getItem('locale') || 'zh_CN',
    messages: {
        zh_CN: {
            ...zh_cn,
        },
        es_MX: {
            ...es_mx,
        },
    },
    missing: (value, key) => {
        // if (!obj[key]) {
        //     obj[key] = key
        //     if (timer) clearTimeout(timer)
        //     timer = setTimeout(() => {
        //         console.log(JSON.stringify(obj))
        //     }, 200)
        // }
    }
});

export default i18n
